From: kaf24@firebug.cl.cam.ac.uk Date: Thu, 25 May 2006 13:54:43 +0000 (+0100) Subject: [BALLOON] Do not allow target to be set below two percent of maximum X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~16025^2~15 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=1ec81e8864eddcd8c2dd912d4375d6f781f2b7da;p=xen.git [BALLOON] Do not allow target to be set below two percent of maximum memory size. Signed-off-by: Keir Fraser --- diff --git a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c index b4ef5c1646..a1c2ea9d55 100644 --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c @@ -360,6 +360,12 @@ static void balloon_process(void *unused) /* Resets the Xen limit, sets new target, and kicks off processing. */ static void set_new_target(unsigned long target) { + unsigned long min_target; + + /* Do not allow target to reduce below 2% of maximum memory size. */ + min_target = max_pfn / 50; + target = max(target, min_target); + /* No need for lock. Not read-modify-write updates. */ hard_limit = ~0UL; target_pages = target;